]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Always enable a11y
authorBastien Nocera <hadess@hadess.net>
Thu, 14 Jun 2012 11:57:09 +0000 (12:57 +0100)
committerBastien Nocera <hadess@hadess.net>
Thu, 14 Jun 2012 17:24:57 +0000 (18:24 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=678095

configure.ac
src/Makefile.am
src/main.c
src/shell-a11y.c [deleted file]
src/shell-a11y.h [deleted file]

index 29354da29d15f21ab361c0a814700f218aec77e0..eaf7daa86e44feb07cbf3526a182a09bc7e58e9e 100644 (file)
@@ -81,6 +81,7 @@ GNOME_DESKTOP_REQUIRED_VERSION=3.5.1
 PKG_CHECK_MODULES(GNOME_SHELL, gio-unix-2.0 >= $GIO_MIN_VERSION
                               libxml-2.0
                                gtk+-3.0 >= $GTK_MIN_VERSION
+                               atk-bridge-2.0
                                folks >= $FOLKS_MIN_VERSION
                                libmutter >= $MUTTER_MIN_VERSION
                                gjs-internals-1.0 >= $GJS_MIN_VERSION
index 80237940558c7a9a0f77004daa42f4a5cc424754..05c8457a88fc53e319e9bbd5398e7b1803354086 100644 (file)
@@ -153,8 +153,6 @@ libgnome_shell_la_SOURCES =         \
        shell-wm-private.h              \
        gnome-shell-plugin.c            \
        shell-app.c                     \
-       shell-a11y.h                    \
-       shell-a11y.c                    \
        shell-app-system.c              \
        shell-app-usage.c               \
        shell-contact-system.c  \
index e398fd145b6087869d845bf2768f4e1cbf2e1a9d..ad4fb3ac59a8745021e08cfc803e44b4826faf26 100644 (file)
 #include <meta/main.h>
 #include <meta/meta-plugin.h>
 #include <meta/prefs.h>
+#include <atk-bridge.h>
 #include <telepathy-glib/debug.h>
 #include <telepathy-glib/debug-sender.h>
 
-#include "shell-a11y.h"
 #include "shell-global.h"
 #include "shell-global-private.h"
 #include "shell-js.h"
@@ -235,6 +235,20 @@ shell_perf_log_init (void)
                                           NULL, NULL);
 }
 
+static void
+shell_a11y_init (void)
+{
+  if (clutter_get_accessibility_enabled () == FALSE)
+    {
+      g_warning ("Accessibility: clutter has no accessibility enabled"
+                 " skipping the atk-bridge load");
+    }
+  else
+    {
+      atk_bridge_adaptor_init (NULL, NULL);
+    }
+}
+
 static void
 default_log_handler (const char     *log_domain,
                      GLogLevelFlags  log_level,
diff --git a/src/shell-a11y.c b/src/shell-a11y.c
deleted file mode 100644 (file)
index 98ddcb9..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-/*
- * Copyright (C) 2010 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include <string.h>
-#include <gmodule.h>
-#include <clutter/clutter.h>
-
-#include "shell-a11y.h"
-
-#define INIT_METHOD "gnome_accessibility_module_init"
-#define DESKTOP_SCHEMA "org.gnome.desktop.interface"
-#define ACCESSIBILITY_ENABLED_KEY "toolkit-accessibility"
-#define AT_SPI_SCHEMA "org.a11y.atspi"
-#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
-
-static gboolean
-should_enable_a11y (void)
-{
-  GSettings *desktop_settings = NULL;
-  gboolean value = FALSE;
-
-  desktop_settings = g_settings_new (DESKTOP_SCHEMA);
-  value = g_settings_get_boolean (desktop_settings, ACCESSIBILITY_ENABLED_KEY);
-
-  g_object_unref (desktop_settings);
-
-  return value;
-}
-
-static char*
-get_atk_bridge_path (void)
-{
-  GSettings *atspi_settings = NULL;
-  GVariant *variant = NULL;
-  char *value = NULL;
-  const char * const *schemas = NULL;
-  gboolean found = FALSE;
-  int i = 0;
-
-  schemas = g_settings_list_schemas ();
-
-  for (i = 0; schemas [i]; i++)
-    {
-      if (!strcmp (schemas[i], AT_SPI_SCHEMA))
-        {
-          found = TRUE;
-          break;
-        }
-    }
-
-  if (!found)
-    {
-      g_warning ("Accessibility: %s schema not found. Are you sure that at-spi or"
-                 " at-spi2 is installed on your system?", AT_SPI_SCHEMA);
-      return NULL;
-    }
-
-  atspi_settings = g_settings_new (AT_SPI_SCHEMA);
-  variant = g_settings_get_value (atspi_settings, ATK_BRIDGE_LOCATION_KEY);
-  value = g_variant_dup_bytestring (variant, NULL);
-  g_variant_unref (variant);
-  g_object_unref (atspi_settings);
-
-  return value;
-}
-
-static gboolean
-a11y_invoke_module (const char *module_path)
-{
-  GModule    *handle;
-  void      (*invoke_fn) (void);
-
-  if (!module_path)
-    {
-      g_warning ("Accessibility: invalid module path (NULL)");
-
-      return FALSE;
-    }
-
-  if (!(handle = g_module_open (module_path, 0)))
-    {
-      g_warning ("Accessibility: failed to load module '%s': '%s'",
-                 module_path, g_module_error ());
-
-      return FALSE;
-    }
-
-  if (!g_module_symbol (handle, INIT_METHOD, (gpointer *)&invoke_fn))
-    {
-      g_warning ("Accessibility: error library '%s' does not include "
-                 "method '%s' required for accessibility support",
-                 module_path, INIT_METHOD);
-      g_module_close (handle);
-
-      return FALSE;
-    }
-
-  invoke_fn ();
-
-  return TRUE;
-}
-
-/*
- * It loads the atk-bridge if required. It checks:
- *  * If the proper gsetting key is set
- *  * If clutter has already enabled the accessibility
- *
- * You need to ensure that the atk-bridge was not loaded before this
- * call, because in that case the application would be already
- * registered on at-spi using the AtkUtil implementation on that
- * moment (if any, although without anyone the application would
- * crash). Anyway this is the reason of NO_AT_BRIDGE.
- *
- */
-void
-shell_a11y_init (void)
-{
-  char *bridge_path = NULL;
-
-  if (!should_enable_a11y ())
-    return;
-
-  if (clutter_get_accessibility_enabled () == FALSE)
-    {
-      g_warning ("Accessibility: clutter has no accessibility enabled"
-                 " skipping the atk-bridge load");
-      return;
-    }
-
-  bridge_path = get_atk_bridge_path ();
-
-  if (a11y_invoke_module (bridge_path) == FALSE)
-    {
-      g_warning ("Accessibility: error loading the atk-bridge. Although the"
-                 " accessibility on the system is enabled and clutter"
-                 " accessibility is also enabled, accessibility support on"
-                 " GNOME Shell will not work");
-    }
-
-  /* NOTE: We avoid to load gail module, as gail-cally interaction is
-   * not fully supported right now.
-   */
-
-  g_free (bridge_path);
-}
diff --git a/src/shell-a11y.h b/src/shell-a11y.h
deleted file mode 100644 (file)
index b285bd7..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-/*
- * Copyright (C) 2010 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __SHELL_A11Y_H_
-#define __SHELL_A11Y_H_
-
-G_BEGIN_DECLS
-
-void shell_a11y_init (void);
-
-G_END_DECLS
-
-#endif /* __SHELL_A11Y_H_ */